import 'package:dio/dio.dart';
import 'package:flutter/material.dart';

import 'app_exception.dart';

class ErrorInterceptor extends Interceptor{

  @override
  void onError(DioError err, ErrorInterceptorHandler handler) {

    // error统一处理
    AppException appException = AppException.create(err);
    // 错误提示
    debugPrint('DioError===: ${appException.toString()}');
    err.error = appException;

    return super.onError(err,handler);

  }
}